/*

 * Copyright (C) 2021 Huawei Device Co., Ltd.

 * Licensed under the Apache License, Version 2.0 (the "License");

 * you may not use this file except in compliance with the License.

 * You may obtain a copy of the License at

 *

 *     http://www.apache.org/licenses/LICENSE-2.0

 *

 * Unless required by applicable law or agreed to in writing, software

 * distributed under the License is distributed on an "AS IS" BASIS,

 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

 * See the License for the specific language governing permissions and

 * limitations under the License.

 */
 package com.aries.ui.helper.navigation;

 import ohos.agp.components.AttrSet;
 import ohos.agp.components.DirectionalLayout;

 import ohos.app.Context;

 /**
  * 自定义键盘容器.
  */
 public class KeyBoardContainer extends DirectionalLayout {
     private KeyBoardListener mKeyBoardListener;

     /**
      * KeyBoardContainer.
      *
      * @param context 上下文
      */
     public KeyBoardContainer(Context context) {
         this(context, null, "");
     }

     /**
      * KeyBoardContainer.
      *
      * @param context 上下文
      * @param attrSet 属性集
      */
     public KeyBoardContainer(Context context, AttrSet attrSet) {
         this(context, attrSet, "");
     }

     /**
      * KeyBoardContainer.
      *
      * @param context   上下文
      * @param attrSet   属性集
      * @param styleName 样式名称
      */
     public KeyBoardContainer(Context context, AttrSet attrSet, String styleName) {
         super(context, attrSet, styleName);
         this.setArrangeListener((left, top, width, height) -> {
             if (mKeyBoardListener != null){
                 mKeyBoardListener.listener(height);}
             return false;
         });
     }

     /**
      * 软键盘监听.
      *
      * @param KeyBoardListener 软键盘监听
      */
     public void setKeyBoardListener(KeyBoardListener KeyBoardListener) {
         this.mKeyBoardListener = KeyBoardListener;
     }
 }
